<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 数组翻转
        var arr = ['pink', 'red', 'blue']
        arr.reverse();
        console.log(arr);
        
        // 数组排序(冒泡排序)
        var arr1 = [4, 1, 13, 2];
        arr1.sort()
        console.log(arr1);

        var arr2 = [11, 1, 13, 23, 2, 34]
        arr2.sort(function(a, b){
            // return a - b;       // 升序排列
            return b - a;       // 降序排列
        })
        console.log(arr2);
        
    </script>
</body>
</html>